package com.example.t1;

import android.content.Context;
import android.database.DatabaseErrorHandler;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;
import android.util.Log;

/**
 * Created by FUSHUANG on 2018/7/20.
 */

public class ToneSqlHelper extends SQLiteOpenHelper {

    public String TAG="fssss";
    public static String TABLE_NAME="person";
    public ToneSqlHelper(Context context, String name, SQLiteDatabase.CursorFactory factory, int version) {
        super(context, name, factory, version);
    }

    public ToneSqlHelper(Context context, String name, SQLiteDatabase.CursorFactory factory, int version, DatabaseErrorHandler errorHandler) {
        super(context, name, factory, version, errorHandler);
    }

    @Override
    public void onCreate(SQLiteDatabase db) {
        String sql = "create table person(id integer primary key autoincrement,name varchar(64),address varchar(64))";
        db.execSQL(sql);
        Log.d(TAG, "onCreate: 数据库和表创建");
    }

    @Override
    public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
         Log.i("updateLog","数据库更新了！");
        Log.d(TAG, "onUpgrade: 数据库更新了");
    }

}
